<#assign ctx=springMacroRequestContext.contextPath />
<#include "/macro/publicMacro.ftl">
<#import "/macro/pagination.ftl" as Pagination>

<@header title="租户列表">
    <link href="${ctx}/resource/common/css/pagination.css" rel="stylesheet">
    <link href="${ctx}/resource/frame/datetimepicker/jquery.datetimepicker.min.css" rel="stylesheet">
</@header>

<@body>
    <h2 class="module-title">租户管理</h2>

    <div class="alert alert-primary" role="alert">
        <form class="form-inline form-margin" action="${ctx}/tenant/list">
            <div class="form-group mb-2">
                <label for="name" >租户名称:</label>
                <input type="text" class="form-control" id="name" name="name" value="${tenant.name}">
            </div>
                <!--  do nothing -->
                <!--  do nothing -->
            <div class="form-group mx-sm-3 mb-2">
                <label for="startEndDate">开始期限:</label>
                <input type="text" class="form-control" name="startEndDate" id="startEndDate" aria-describedby="期限" placeholder="期限" value="${(tenant.startEndDate?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
            <div class="form-group mx-sm-3 mb-2">
                <label for="endEndDate">结束期限:</label>
                <input type="text" class="form-control" name="endEndDate" id="endEndDate" aria-describedby="期限" placeholder="期限" value="${(tenant.endEndDate?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
                <div class="form-group mb-2">
                    <label for="enable" >是否可用:</label>
                    <input type="text" class="form-control" id="enable" name="enable" value="${tenant.enable}">
                </div>
            <div class="form-group mx-sm-3 mb-2">
                <label for="startCreateTime">开始创建时间:</label>
                <input type="text" class="form-control" name="startCreateTime" id="startCreateTime" aria-describedby="创建时间" placeholder="创建时间" value="${(tenant.startCreateTime?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
            <div class="form-group mx-sm-3 mb-2">
                <label for="endCreateTime">结束创建时间:</label>
                <input type="text" class="form-control" name="endCreateTime" id="endCreateTime" aria-describedby="创建时间" placeholder="创建时间" value="${(tenant.endCreateTime?string('yyyy-MM-dd hh:mm:ss'))!}">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>

            <div class="form-group mx-sm-3 mb-2">
                <button type="submit" class="btn btn-primary">查询</button>
            </div>

            
            <div class="form-group mx-sm-3 mb-2" style="float:right">
                <span style="float:left"><a href="${ctx}/tenant/toAdd">添加数据</a></span>
            </div>
            
        </form>
    </div>

    <div class="table-responsive">
        <table class="table table-striped table-bordered">
            <thead>
                <th></th>
                <th>租户名称</th>
                <th>描述</th>
                <th>期限</th>
                <th>是否可用</th>
                <th>创建时间</th>
                <th>更新时间</th>
                <th>操作</th>
            </thead>
            <tbody>
            <#list tenants.beans as tenant>
                <tr>
                    <th>${tenant.id!}</th>
                    <th>${tenant.name!}</th>
                    <th>${tenant.description!}</th>
                    <#--<th>${tenant.privateKey!}</th>-->
                    <#--<th>${tenant.publicKey!}</th>-->
                    <#--<th>${tenant.privateKey2!}</th>-->
                    <#--<th>${tenant.publicKey2!}</th>-->
                    <th>${(tenant.endDate?string('yyyy-MM-dd hh:mm:ss'))!} </th>
                    <th>${tenant.enable!}</th>
                    <th>${(tenant.createTime?string('yyyy-MM-dd hh:mm:ss'))!} </th>
                    <th>${(tenant.updateTime?string('yyyy-MM-dd hh:mm:ss'))!} </th>
                    <th><a class="btn btn-primary btn-sm" href="${ctx}/tenant/view/${tenant.id?c}" role="button" aria-pressed="true">详情</a>
                        <a class="btn btn-info btn-sm" href="${ctx}/tenant/toEdit/${tenant.id?c}" role="button" aria-pressed="true">编辑</a>
                    </th>
                </tr>
            </#list>
            </tbody>
        </table>

        <@Pagination.pagination formId="tenantForm"
            pageNo=tenants.pageNo
            pageTotal=tenants.pageTotal
            total=tenants.total
            pageSize=tenants.pageSize
            action="${ctx}/tenant/list">
        </@Pagination.pagination>
    </div>
</@body>

<@footer>
    <script src="${ctx}/resource/frame/datetimepicker/jquery.datetimepicker.full.min.js"></script>

    <script type="text/javascript">
        $(function () {
                $('#startEndDate').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#endEndDate').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#startCreateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#endCreateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#startUpdateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
                $('#endUpdateTime').datetimepicker({
                    format:'Y-m-d H:i:s',
                    lang:'zh'});
        });
    </script>

    <script src="${ctx}/resource/common/js/pagination.js"></script>
    <script src="${ctx}/resource/common/js/jquery.validate.min.js"></script>
</@footer>